/**
 * @program: yygh_parent
 * @ClassName ScheduledTask
 * @description:
 * @author: zyw
 * @create: 2023-06-12 21:55
 * @Version 1.0
 **/
package com.atguigu.yygh.task.job;

import com.atguigu.yygh.mq.MqConst;
import com.atguigu.yygh.mq.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@EnableScheduling
public class ScheduledTask {

    @Autowired
    private RabbitService rabbitService;

    @Scheduled(cron = "0 * * * * ?")
    public void task() {
        System.out.println("new Date().toString() = " + new Date().toString());
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK, MqConst.ROUTING_TASK_8, " ");
    }

}
 
